package org.bonorsoft.modules.statistical.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.bonorsoft.modules.education.service.IEduInforService;
import org.bonorsoft.modules.education.service.IOutStaticService;
import org.bonorsoft.modules.statistical.entity.AllSchoolVo;
import org.bonorsoft.modules.statistical.entity.StatisticalBasicData;
import org.bonorsoft.modules.statistical.out.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/education/out")
@Api(tags="学校数据统计")
@Slf4j
public class OutStaticController {

    @Autowired
    private IOutStaticService outStaticService;
    @Autowired
    private IEduInforService eduInforService;

    @ApiOperation("全市各县区各学段学校数")
    @GetMapping(value = "getSchoolsNumber")
    public List<SchoolsNumber> getSchoolsNumber(){
        return outStaticService.getSchoolsNumber();
    }

    @ApiOperation("全市各县区各学段教师学历结构")
    @GetMapping(value = "getQualifications")
    public List<Qualifications> getQualifications(){
        return outStaticService.getQualifications();
    }

    @ApiOperation("全市各县区各学段教师年龄结构")
    @GetMapping(value = "getAgeStructure")
    public List<AgeStructure> getAgeStructure(){
        return outStaticService.getAgeStructure();
    }

    @ApiOperation("全市各县区各学段教职工职称结构")
    @GetMapping(value = "getTitleStructure")
    public List<TitleStructure> getTitleStructure(){
        return outStaticService.getTitleStructure();
    }

    @ApiOperation("全市各县区各学段教职工数量")
    @GetMapping(value = "getTeacherNumber")
    public List<TeacherNumber> getTeacherNumber(){
        return outStaticService.getTeacherNumber();
    }

    @ApiOperation("全市各县区各学段在校生人数")
    @GetMapping(value = "getInSchoolNumber")
    public List<InSchoolNumber> getInSchoolNumber(){
        return outStaticService.getInSchoolNumber();
    }

    @ApiOperation("全市各县区各学段师生比例")
    @GetMapping(value = "getStaffStudentRatio")
    public List<StaffStudentRatio> getStaffStudentRatio(){
        return outStaticService.getStaffStudentRatio();
    }

    @ApiOperation("全市各县区各学段男女生比例")
    @GetMapping(value = "getBoyGirlRatio")
    public List<BoyGirlRatio> getBoyGirlRatio(){
        return outStaticService.getBoyGirlRatio();
    }

    @ApiOperation("全市分学科、不同学段分学科教师数量统计")
    @GetMapping(value = "getSubjectTeacher")
    public List<SubjectTeacher> getSubjectTeacher(){
        return outStaticService.getSubjectTeacher();
    }

    @ApiOperation("全市各县区本年高考考生数量")
    @GetMapping(value = "getExamStudent")
    public List<ExamStudent> getExamStudent(@ApiParam(name = "year", value = "年份", defaultValue = "2020")
                                                @RequestParam(name="year",defaultValue="2020") Integer year){
        return outStaticService.getExamStudent(year);
    }

    @ApiOperation("全市入学人数统计")
    @GetMapping(value = "getInSchoolStudent")
    public List<InSchoolStudent> getInSchoolStudent(){
        return outStaticService.getInSchoolStudent();
    }

    @ApiOperation("全市各县区各学段毕业学生统计")
    @GetMapping(value = "getGraduationStudent")
    public List<GraduationStudent> getGraduationStudent(){
        return outStaticService.getGraduationStudent();
    }

    /**
     * 学校信息
     * @param type
     * @param year
     * @return
     */
    @ApiOperation("学校信息")
    @GetMapping(value = "schoolInformation")
    public AllSchoolVo getAllInformation(@ApiParam(name = "type", value = "学校类型(0-幼儿园；1-普通小学；2-普通初中；3-普通高中；4-特殊教育)") @RequestParam(name="type",required=false) String type,
                                         @ApiParam(name = "year", value = "年份", defaultValue = "2019") @RequestParam(name="year",defaultValue="2019") Integer year){
        return eduInforService.getAllInformation(year, type);
    }

    @ApiOperation("全市各县区适龄入学儿童数量")
    @GetMapping(value = "getAgeStudent")
    public List<AgeStudent> getAgeStudent(){
        return outStaticService.getAgeStudent();
    }

    @ApiOperation("全市各县区各学段民办学校数")
    @GetMapping(value = "getPrivateSchool")
    public List<PrivateSchool> getPrivateSchool(){
        return outStaticService.getPrivateSchool();
    }

    @ApiOperation("全市各县区各学段专职教职工数量")
    @GetMapping(value = "getFullTimeFaculty")
    public List<FullTimeFaculty> getFullTimeFaculty(){
        return outStaticService.getFullTimeFaculty();
    }

    @ApiOperation("全市各县区各学段外国籍学生数量")
    @GetMapping(value = "getForeignStudent")
    public List<ForeignStudent> getForeignStudent(){
        return outStaticService.getForeignStudent();
    }

    @ApiOperation("全市各县区各学段平均班额")
    @GetMapping(value = "getAverageClass")
    public List<AverageClass> getAverageClass(){
        return outStaticService.getAverageClass();
    }

    @ApiOperation("全市各县区校外培训机构数")
    @GetMapping(value = "getInstitutionNumbers")
    public List<InstitutionNumbers> getInstitutionNumbers(){
        return outStaticService.getInstitutionNumbers();
    }
}
